<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/22 0022
 * Time: 13:54
 */

namespace app\model\model;


class Role extends Base
{

    /**
     * 获取角色列表
     * */
    public function getRoleLists($where=false, $field = 'id'){
        return $this->where($where)->order('id asc')->column($field);
    }
    /**
     * 获取角色列表
     * */
    public function getList($where=false,$li){
        return $this->order('id asc')->where($where)->paginate($li);
    }
    /**
     * 获取角色列表
     * */
    public function getListAll(){
        return $this->order('id asc')->select();
    }
    /**
     * 添加一个角色
     * */
    public function addOne($data){
        return $this->data($data)->save();
    }
    public function del($id){
        return $this->where(['id'=>$id])->delete();
    }
    public function delAll($id){
        return $this->where('id','in',$id)->delete();
    }
    /**
     * 获取一个角色
     * */
    public function getOneById($id){
        return $this->where(['id'=>$id])->find();
    }
    /**
     * 修改角色
     * */
    public function updateOne($id,$data){
        return $this->where(['id'=>$id])->update($data);
    }
}